package miku.firstgame.model.proxy
{
	import miku.firstgame.constrants.ClientParam;
	import miku.firstgame.model.Me;
	import miku.firstgame.net.IConnection;
	import miku.firstgame.net.proxy.Connection;

	import org.puremvc.as3.patterns.proxy.Proxy;

	public class VersionProxy extends Proxy
	{
		public static const NAME:String = "VersionProxy";

		public function VersionProxy()
		{
			super(NAME);
		}

		override public function onRegister():void
		{
			super.onRegister();
			//Connection.getInstance().registerProtocolInterest(handleInit, ["init"]);
		}

		override public function onRemove():void
		{
			super.onRemove();
			//Connection.getInstance().unregisterHandler(handleInit);
		}

		/**
		 * <init f="1.0" s="0000" u="9"/>
		 * */
		private function handleInit(xml:XML, connection:IConnection):void
		{
			ClientParam.SERVER_MARJOR_VERSION = xml.@f;
			ClientParam.SERVER_MINOR_VERSION = xml.@s;
			Me.Instace.id = xml.@u;
			//trace("test:" + xml.toXMLString());

		}
	}
}
